Fill-in-the-blank Querying Analysis
Overview
Qarbine provides 2 fill-in-the-blank tools. Data criteria wise they are very similar. The difference is that Query by Example (QBE) shows results in a tabular manner like the Data Source Designer.In this example we are going to use Report by Example (RBE) which provides for data grouping, headers, fonts, formulas, and many other formatting options.
Walkthrough
Opening RBE
The Report By Example tool can be accessed in several ways including:
- from the sign on page
- from another tool’s upper left menu.
. . .
Indicating the Data Context
Top top-left area of the initial Report By Example tool is depicted below.
Briefly,a “Data service” is set up by the Qarbine Administrator to provide access to your data such as a MongoDB Atlas instance. It indicates the Qarbine compute node to run the query and the target data endpoint to perform the query. A MongoDB Atlas instance, like many other data servers, may further segregate information into databases. Databases then contain the actual data. In MongoDB they are called “collections” while in traditional SQL data servers they are called “tables”.
Make the 3 drop down selections left to right shown below.
The general structure of the movies collection is depicted on the left hand side. The icon indicates tree nodes can be expanded and contracted in the standard tree widget fashion.
Top Portion of Schema | Bottom Portion of Schema |
---|---|
Choosing the Fields
In the left hand tree area, check the fields in the following order year, rated, title and runtime. The top middle area shows
The middle area also shows the effective query and a rough rendering of the template. The meaning of the text to the left and right of the vertical bar will become clearer once you review the Template Designer overview.
Expand the embedded document awards node and make the selections shown below.
The criteria now shows the following.
The query is now
db.movies.find({},{_id: 0,"year":1,"rated":1,"title":1, "runtime":1,"awards.wins":1,"awards.text":1,"awards.nominations":1}).limit(25)
The rough template rendering is now
Expand the cast embedded array node and make the selections shown below.
The query is now
db.movies.find({},{_id: 0,"year":1,"rated":1,"title":1,"runtime":1, "awards.wins":1,"awards.text":1,"awards.nominations":1,"cast":1}).limit(25)
The rough template rendering is now
The rough template rendering is now
Adding Criteria
The QBE and RBE tools support a large variety of criteria keywords and phrases. The simplest criteria is equality and can be indicated by typing in the value. If the criteria is for a string with blanks then enclose it in quotes. Here we indicate that we want movies in 2014.
The query becomes
"awards.wins":1,"awards.text":1,"awards.nominations":1,"cast":1}).limit(25)
We want the top movies based on award wins. Directly enter “ascending” as shown below.
Alternatively click on the floating pencil
choose
and click
The query becomes
db.movies.find({"year":2014},{_id: 0,"year":1,"rated":1,"title":1, "runtime":1,"awards.wins":1, "awards.text":1,"awards.nominations":1,"cast":1})
.sort({"awards.wins":1}).limit(25)
Adding Formatting
RBE formatting can be specified using typed in keywords or the pencil icon dialog.
Click on the highlighted ‘+’ below to toggle seeing the formatting options.
Fill in the text as shown below.
Running the Specification
Clicking automatically generates the query, report template, runs the query, and processes the data. It uses a lot of defaults at this point. A portion of the result is shown below.
This formatting can be prettied up a bit in the RBE tool. Within minutes though we were able to interact with MongoDB data containing an embedded document and an embedded array and retrieve data based on some criteria without having to be aMongoDB query expert at all. There are many other features of the Report by Example tool discussed in its own document.
Saving your Work
Activate the Design tab as shown below.
Click the save icon .
Navigate to your private folder.
Enter a name.
Your components can include longer descriptions and tags as well to better convey their purpose and group them in an ad hoc manner independent of their catalog folder location. Users can search the catalog by keywords and tags.
Depending on your Qarbine license and configuration, storage zones can be used to save components and analysis results in appropriate regions to adhere to GDPR or other regulations. The analysis results are more likely to contain data covered under regulations than the templates which are merely referencing field names.
Click
Another RBE Example
Using the MongoDB sample sales data we can quickly get an analysis of sales in the Denver store including calculating several order metrics. Below is the result after setting things up.
Sometimes this type of output is all that is needed which can save significant time and resources.
Indicating the Data Context
To start a new component click
If prompted by the dialog below, choose Yes.
Adjust the drop downs for the desired data context shown below.
Choosing the Fields
The fields selected are shown below. Select them as shown in top down order. You'll need to expand the tree nodes by toggling the icons.
Adding the Criteria and Formatting
The criteria and formatting items are shown below.
The “value” above is a calculated column created using the button. Its definition is shown below.
The generated query is
db.sales.find({"storeLocation":"Denver"},{_id: 0,"storeLocation":1,
"customer.email":1,"items.name":1, "items.price":1,"items.quantity":1}).limit(25)
The rough layout is shown below.
Run the RBE by clicking .
Below is a cross reference of the design inputs to their output effects.
Saving your Work
Activate the Design tab as shown below.
Click the save icon .
Navigate to your private folder.
Enter a name.
Click
Next Steps
There are many other features of the Report by Example tool discussed in its own document.
There are many other features of the Query by Example tool discussed in its own document.
For now, return to the “1) Qarbine Sandbox Bucket List” document to continue the quick tour.